package cn.gzsxt.po;

public class PageOut {
	private Integer pageSize = 10;
	private Integer totalPage;
	private Integer totalCount = 0;
	private Integer currentPage = 1;
	private String keyword = "";
	private boolean isPage = true;
	
	public boolean isPage() {
		return isPage;
	}
	public void setPage(boolean isPage) {
		this.isPage = isPage;
	}
	public Integer getPageSize() {
		return pageSize;
	}
	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
		setTotalPage();
	}
	public Integer getTotalPage() {
		return totalPage;
	}
	public void setTotalPage() {
		if (totalCount != 0){
			this.totalPage = totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize +1;
		} else {
			this.totalPage = 0;
		}
	}
	public Integer getTotalCount() {
		return totalCount;
	}
	public void setTotalCount(Integer totalCount) {
		this.totalCount = totalCount;
		setTotalPage();
	}
	public Integer getCurrentPage() {
		return currentPage;
	}
	public void setCurrentPage(Integer currentPage) {
		this.currentPage = currentPage;
	}
	
	public String getKeyword() {
		return keyword;
	}
	
	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}
	
	public Integer getBeginIndex(){
		return (currentPage-1) * pageSize;
	}
	
	public Integer getEndIndex(){
		if (currentPage==totalPage){
			return totalCount % pageSize;
		} else {
			return pageSize;
		}
	}
	public PageOut() {
		super();
		this.pageSize = 10;
		this.totalCount = 0;
		this.currentPage = 1;
		this.keyword = "";
	}
	
}
